//
//  UIBarButtonItem+Extension.swift
//  WangFangWeiBo
//
//  Created by 王方 on 16/7/9.
//  Copyright © 2016年 wf. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    /**
     let button = UIButton()
     button.setTitle("注册", forState: .Normal)
     button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
     button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
     button.titleLabel?.font = UIFont.systemFontOfSize(14)
     button.sizeToFit()
     */
    //提供便利的构造函数
    convenience init(title:String,target: AnyObject?,action:Selector) {
        self.init()
        let button = UIButton()
        //添加点击事件
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.titleLabel?.font = UIFont.systemFontOfSize(14)
        button.sizeToFit()
        customView = button
        
    }

}